#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    this->setWindowTitle("Compress_Tool");
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_loadBtn_clicked()
{
    loadFilePath = QFileDialog::getOpenFileName(this,tr("Open_Load_File"),"*.pat");
    ui->filePathLab->setText(loadFilePath);
}

void Widget::on_compressBtn_clicked()
{
    compress.SetPatFilePath("C:/Users/huabao/Desktop/test.pat");
    QString num = ui->numberLet->text();
    if(num.isEmpty())
    {
        compress.setMax(65535);
    }
    else if(num.toInt() > 1)
    {
        compress.setMax(num.toInt());
    }
    else
        compress.setMax(65535);
    compress.ReadPatFile();
}

void Widget::on_quitBtn_clicked()
{
    this->close();
}
